package com.swak.persistence.mybatis.methods;

import java.util.Set;

import com.swak.annotation.table.Scene;
import com.swak.utils.Sets;

import lombok.Getter;
import lombok.RequiredArgsConstructor;

/**
 * 支持的SQL语句
 * 
 * @author lifeng
 * @date 2021年1月21日 下午5:33:08
 */
@RequiredArgsConstructor
@Getter
public enum Sqls {

	/**
	 * 版本比较
	 */
	@Deprecated
	VERSION("version", null),

	/**
	 * 插入
	 */
	INSERT("insert", Sets.newHashSet(Scene.Full, Scene.Primary, Scene.Relation, Scene.Curd)),

	/**
	 * 强插入
	 */
	INSERTIVE("insertive", Sets.newHashSet(Scene.Full, Scene.Primary, Scene.Relation, Scene.Curd)),

	/**
	 * 插入 - 更新
	 */
	@Deprecated
	REPLACE("replace", null),

	/**
	 * 统计
	 */
	@Deprecated
	STATISTIC("statistic", null),

	/**
	 * 开关
	 */
	@Deprecated
	TOGGLE("toggle", null),

	/**
	 * 统计
	 */
	MERGE("merge", Sets.newHashSet(Scene.Full, Scene.Relation, Scene.Stat)),

	/**
	 * 批量插入
	 */
	BATCH_INSERT("batchInsert", Sets.newHashSet(Scene.Full, Scene.Primary, Scene.Relation)),

	/**
	 * 删除
	 */
	DELETE("delete", Sets.newHashSet(Scene.Full, Scene.Primary, Scene.Relation, Scene.Curd)),

	/**
	 * 选择删除
	 */
	DELETE_SELECTIVE("deleteSelective", Sets.newHashSet(Scene.Full, Scene.Relation)),

	/**
	 * 修改
	 */
	UPDATE("update", Sets.newHashSet(Scene.Full, Scene.Primary, Scene.Relation, Scene.Curd)),

	/**
	 * 选择项目修改
	 */
	UPDATE_SELECTIVE("updateSelective", Sets.newHashSet(Scene.Full, Scene.Primary, Scene.Relation)),

	/**
	 * 选择项目修改
	 */
	UPDATIVE("updative", Sets.newHashSet(Scene.Full, Scene.Primary, Scene.Relation)),

	/**
	 * 选择项目修改
	 */
	@Deprecated
	CLEAR_SELECTIVE("clearSelective", Sets.newHashSet(Scene.Full, Scene.Primary, Scene.Relation)),

	/**
	 * 查询
	 */
	GET("get", Sets.newHashSet(Scene.Full, Scene.Primary, Scene.Relation, Scene.Stat, Scene.Curd)),

	/**
	 * 选择列查询
	 */
	GET_SELECTIVE("getSelective", Sets.newHashSet(Scene.Full, Scene.Primary)),

	/**
	 * 唯一索引查询
	 */
	GET_UNIQUE("getUnique", Sets.newHashSet(Scene.Full, Scene.Primary, Scene.Relation)),

	/**
	 * 锁定
	 */
	LOCK("lock", Sets.newHashSet(Scene.Full, Scene.Primary)),

	/**
	 * 判断
	 */
	EXISTS("exists", Sets.newHashSet(Scene.Full, Scene.Primary)),

	/**
	 * 判断
	 */
	EXISTS_BY_CONDITION("existsByCondition", Sets.newHashSet(Scene.Full, Scene.Primary, Scene.Relation)),

	/**
	 * 判断
	 */
	EXISTS_SELECTIVE("existsSelective", Sets.newHashSet(Scene.Full, Scene.Primary, Scene.Relation)),

	/**
	 * 查询
	 */
	QUERY_BY_CONDITION("queryByCondition",
			Sets.newHashSet(Scene.Full, Scene.Primary, Scene.Relation, Scene.Curd, Scene.Stat)),

	/**
	 * 查询
	 */
	QUERY_SELECTIVE("querySelective",
			Sets.newHashSet(Scene.Full, Scene.Primary, Scene.Relation, Scene.Curd, Scene.Stat)),

	/**
	 * 查询
	 */
	QUERY_BY_CONDITION_SELECTIVE("queryByCondition_Selective",
			Sets.newHashSet(Scene.Full, Scene.Primary, Scene.Relation, Scene.Curd, Scene.Stat)),

	/**
	 * 查询
	 */
	COUNT_BY_CONDITION("countByCondition",
			Sets.newHashSet(Scene.Full, Scene.Primary, Scene.Relation, Scene.Curd, Scene.Stat)),

	/**
	 * 查询
	 */
	COUNT_BY_SELECTIVE("countBySelective",
			Sets.newHashSet(Scene.Full, Scene.Primary, Scene.Relation, Scene.Curd, Scene.Stat));

	private final String method;
	private final Set<Scene> scenes;
}
